<template>
  <div class="container mx-auto">
    <div id="nav">
      <router-link to="/layout/Home">Home</router-link> |
      <router-link to="/layout/About">About {{ sum }}</router-link>
      <div class="text-gray-700 dark:text-gray-300 dark:bg-gray-900 w-full h-full">
      <button @click="lightMode" class="border-2 p-1 m-1">普通模式</button>
      <button @click="darkMode" class="border-2 p-1 m-1">暗黑模式</button>
      <div class="p-1">
        <h1 class="text-2xl">我是H1</h1>
        <h2 class="text-xl">我是H2</h2>
        <h3 class="text-lg">我是H3</h3>
        <h4 class="">我是H4</h4>
      </div>
</div>
    </div>
    <router-view/>
  </div>
</template>

<script lang='ts'>
import { ref, reactive } from 'vue'
import { zhCN, dateZhCN } from 'naive-ui'
import { NDatePicker } from 'naive-ui'
export default {
  components: {
    NDatePicker,
  },
  setup() :any {
    const count = reactive({id: 1})
    const sum = ref('Hello')
    
    const darkMode = () => {
  const clsList = document.documentElement.classList;
  if(!clsList.contains('dark-mode')) {
    document.documentElement.classList.add('dark-mode');
  }
}
const lightMode = () => {
  document.documentElement.classList.remove('dark-mode')
}
    return { 
      count,
      sum,
      locale: ref(null),
      dateLocale: ref(null),
      zhCN,
      dateZhCN,
      darkMode,
      lightMode
    }
  }
}
function fn(name :string) :string {
  return ''
}
</script>

<style>
* {
  font-size: 16px;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}
</style>
